package com.fyzk.activity.fragment;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.fyzk.base.BaseFragment;
import com.fyzk.activity.news.BaseFragmentAdapter;
import com.tyjc.lottery.R;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *
 * @author Administrator
 * @mood
 * @description 比分开奖Fragment
 * @date 2018/9/17 14:44
 * </p>
 */
public class ScoreAwardFragment extends BaseFragment {
    private View mainView;

    private TabLayout mTabLayout;
    private ViewPager mViewPager;

    private List<Fragment> mFragments;
    private String[] mTitles = {"比分", "开奖"};

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mainView = inflater.inflate(R.layout.fragment_score_award, null);
        initView();
        initData();
        return mainView;
    }

    private void initView() {
        mTabLayout = mainView.findViewById(R.id.scoreAwardFragUI_tabLayout);
        mViewPager = mainView.findViewById(R.id.scoreAwardFragUI_viewPager);

        mFragments = new ArrayList<>();

        ScoreFragment fragment1 = new ScoreFragment();
        AwardFragment fragment2 = new AwardFragment();

        mFragments.add(fragment1);
        mFragments.add(fragment2);

        BaseFragmentAdapter adapter = new BaseFragmentAdapter(getChildFragmentManager(), mFragments, mTitles);
        mViewPager.setAdapter(adapter);
        mTabLayout.setupWithViewPager(mViewPager);
    }

    private void initData() {
        mTabLayout.setMinimumHeight(200);
        mTabLayout.setPadding(0, 50, 0, 0);
    }

}
